<?php

//包含公共文件
include './common/common.php';


//获取cookie, 用户名和管理员名
$admin      = isset($_COOKIE['admin'])? $_COOKIE['admin'] : '' ;
//var_dump($username);
$username = isset($_COOKIE['username'])? $_COOKIE['username'] : '' ;
//var_dump($username);

//获取title
$resTitle = mySelect($link , '*', DB_TABLE_SITE , 'where sid=8');
$title = $resTitle[0]['stitle'];

//查询数据库
$resHead = mySelect($link , '*', DB_TABLE_CG , 'where parentid = 0 and cisdel=0 order by orderby desc');
//var_dump($resHead);

//查询用户信息
$resHead2 = mySelect($link , '*', DB_TABLE_USER , "where username = '$username'");
//var_dump($resHead2);

//获取相关数据
$userType    = $resHead2[0]['usertype'];
$loginStatus = $resHead2[0]['afterlogin'];
$txPic  = $resHead2[0]['picture'];
$grade = $resHead2[0]['grade'];

//打包数组
$arr = compact('webSite', 'docRoot' , 'title' , 'resHead', 'loginStatus' , 'userType' , 'txPic' , 'username' , 'grade' , 'admin');
//发送
display('head.html', $arr);